

#include "atomic_op_namespace.h"

#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <stdbool.h>
#endif
#include <sys/atomic.h>

bool bool_compare_and_swap_1(volatile uint8_t *, uint8_t, uint8_t, ...)
    asm("__sync_bool_compare_and_swap_1");

bool
bool_compare_and_swap_1(volatile uint8_t *addr, uint8_t oldval,
	uint8_t newval, ...)
{
	return atomic_cas_8(addr, oldval, newval) == oldval;
}
